Grinding your teeth during sleep is kind of a sleep disorder. Also called bruxism, it can happen at any age.
Children sometimes do it as their teeth are changing from their primary to their permanent ones. Some people just get a wear spot, but in more serious cases, you might grind right through the enamel to the pulp.
The best prevention is a hard, plastic mouth guard created by your dentist. It will discourage grinding and protect the surface of your teeth.