Dear All,
Is there any way to restrict a course or category for a age group. If it possible by customization in the code. Please suggest where I need to customization.
One solution I can think of is adding a new user profile date of birth field: http://docs.moodle.org/27/en/admin/user/profile/index - and then using that data to create a custom enrolment plugin / theme category renderer / course format to somehow restrict what you want to restrict. But the specific code I don't know off the top of my head, but I would have thought the new field would be put in the $USER global.
That should get you started.
Just to say that, if you're in the US, do not put that date of birth where anyone can see. It's one of the crucial big three in Personally Identifiable Information. Smarter to enter just the grade, especially since I work with gifted kids for whom the DOB is not predictive of grade.
As long as you don't have the self-enrollment plugin turned on, it seems to me this is easier to do outside of Moodle with the data you've got on birth dates. You make a csv from a spreadsheet, choose the courses you want certain ages to go into, and so forth.