Grammar is the study of rules governing the use of language. The set of rules governing a particular language is the grammar of that language; thus, each language can be said to have its own distinct grammar. Grammar is part of the general study of language called linguistics. Grammar is a way of thinking about language.
The subfields of contemporary grammar are phonetics, phonology, morphology, syntax, semantics, and pragmatics. Traditional grammars include only morphology and syntax.
In linguistics, Syntax is the study of the rules, or "patterned relations", that govern the way words combine to form phrases and phrases combine to form sentences. The word originates from the Greek words συν (syn), meaning "co-" or "together", and τάξις (táxis), meaning "sequence, order, or arrangement". The combinatory behavior of words is governed to a first approximation by their part of speech (noun, adjective, verb, etc., a categorization that goes back in the Western tradition to the Greek grammarian Dionysios Thrax). Modern research into natural language syntax attempts to systematize descriptive grammar and, for many practitioners, to find general laws that govern the syntax of all languages. It is unconcerned with prescriptive grammar (see Prescription and description).
Theories of syntax differ in the object of study. While formal grammars (especially in the generative grammar tradition) have focused on the mental process of language production (i-language), empirical grammars have focused on linguistic function, explaining the language in use (corpus linguistics). The latter often encodes frequency data in addition to production rules, and provide mechanisms for learning the grammar (or at least the probabilities) from usage data. One way of considering the space of grammars is to distinguish those that do not encode rule frequency (the majority) and those that do (probabilistic grammars).