Children can learn languages as early as 18 months old, but they can only learn by observing adults who do it correctly, so they have no way of actively telling what’s right from wrong – they aren’t studying languages, they just absorb them.
Nonetheless, they follow the right rules at the right time. Even deaf children who learn sign language from their parents use proper grammar.