The Cambridge Dictionary of Philosophy defines grammar as a system of rules specifying a language. In other words language is generated from a grammatical skeleton. Noam Chomsky's theory of transformational grammar implies that these rules may be embedded in a deep structure which is based on how the human brain processes and expresses information. In other words, it's innate. There are other theories, but most assume that a basic universality underlies all human languages in terms of noun phrases, verb phrases and the ideas of actor, actions, objects of actions, states of existence and modifiers. The predicate calculus apparently can break down any human language into a series of nested and interlocking functions F(x,y) F(x); for example PASSED(SHE,THE(TEST)). IS(THE(CAT), BLACK). (The cat is black).
COME FROM(I, CHICAGO); IS(CHICAGO,THE(CITY1)BIG(CITY1)); IS ON(CHICAGO,THE(LAKE)). (I come from Chicago, the big city on the lake.)
Although natural languages implement these rules in different ways, the grammatical structure of any language must reflect these rules for the language to be intelligible.