Like sucking on pacifiers and thumbs, grinding the teeth (called bruxism) is a common habit that usually disappears on its own as young children grow. The two peak periods of bruxism are as the baby teeth arrive in very young children and again at 5 or 6 as the permanent teeth begin to come in.
Grinding could slowly damage the enamel of the teeth, but the baby teeth do not remain in place long enough for that to be a concern. The habit usually stops long before permanent damage to the adult teeth occurs.
In the short run nothing needs to be done, but anything relaxing before bed might help (a warm bath, a backrub, some soothing music, some chamomile tea).
If the bruxism continues, your dentist might provide a temporary appliance to break the habit of nighttime grinding.