Even taf (little children) attended the Hakhel ceremony in the Beis Hamikdash. Although they were too young to comprehend the words of Torah that were being read, the reason for bringing them was to impart a schar (reward) to those who brought them. Tosfos in Maseches Chagigah cites this as a source for bringing young children to shul. However, poskim say that children who run around in shul instead of behaving respectfully do not bring honor to the shul, and should rather be left at home. It's unacceptable to bring children to shul if they disturb the kavanah of the congregants; certainly they do not earn a schar for their parents, vdai lโmayvin (and a word to the wise is sufficient). When children are old enough to understand the concept of davening in shul, even if they are not old enough to daven much, they should be trained to stand bโaimah ubโyirah (with awe and fear) of Hashem and answer amen when appropriate; that is in itself a major accomplishment. Girls may be in the menโs section of the shul as long as they are not old enough to understand the concept of keeping men and women separated, and they are dressed appropriately.