It is a mitzva to train children to perform mitzvot, and from the moment a boy or girl reaches the stage at which he or she understands the Megilla and can listen to it as halakha requires, one must train them to do so. This does not depend on a child’s age, but on his personal development. Since the Megilla reading is quite long, most children reach the stage at which they can listen to the entire Megilla properly after the age of nine.
It is a good practice to bring younger children – from age five or six – to the synagogue to hear the Megilla. Even though they have not yet reached the age of education in the mitzva of Megilla reading, as they cannot listen to the entire Megilla meticulously, it is still good to bring them, because they understand the main gist of the story. However, one should not bring small children to the synagogue if they are liable to disrupt the reading and make it difficult for others to hear the Megilla. One must take care not to try to go beyond the letter of the law in educating his children at the expense of the other synagogue attendees, who might suffer because of his children’s disruptions.
In order to stimulate joy and grab the children’s attention, there is a custom for the congregation to read aloud four verses that essentially signal the beginning and end of the miracle. Afterward, the reader reads these verses again from the scroll (Rema 690:17; mb 689:16; based on Mordechai and Levush). (The verses are: “A Jewish man” [Esther 2:5]; “Mordechai left” [ibid. 8:15]; “The Jews” [ibid. 8:16]; and “For Mordechai” [ibid. 10:3].)
It seems that the purpose of the custom to “beat” Haman with noisemakers is, likewise, to excite the children during the Megilla reading. However, one must be careful not to lend undue importance to this custom and not to make noise when the reader continues to read the Megilla (sa 690:17; also see mb ad loc. 59 and bhl).