Gratification disorder, or more properly precocious masturbation (as such behavior is neither unusual or the sign of any underlying illness), is a behavior that doctors have to be trained to recognize in young children so that it is not mistaken for epilepsy.
Masturbation is common in all ages of children, and most children learn to do it in private. However, some communicative children (ages 4 and up), often do not understand social conventions about sexuality well enough to understand that they should not masturbate in front of others.
Occasionally, a parent will mistake this behavior for a seizure disorder. As the behavior often isn't apparent in the doctor's office, physicians often believe the child is suffering from a seizure disorder and order anti-seizure medication. This often stops the behavior, but has unacceptable side effects.
However, gratification disorder is far more common than epilepsy, so the chances of a patient exhibiting seizure-like behavior is more likely not to have epilepsy. As such, physicians have to be trained to do a differential diagnosis of both conditions and rule out gratification disorder before coming to a diagnosis of epilepsy.
Ironically, the "treatment" for the "disorder" is straightforward - children of any age will quickly grasp the concept of privacy about the matter and behave more appropriately.