The grammar o a leid is a set o rules tae produce sentences in thon leid.
The term refers baith tae rules that descrives whit fowk actually says (descriptive grammar), an thaim that prescrives whit fowk shuid say (prescriptive grammar). The term grammar whan uised in schuils for ordinar refers tae prescriptive grammar, but linguists mair aften uises grammar wi the first o thae meanins. Linguists uises the seimilar term seentax tae refer tae the internal structur o sentences produced bi a grammar.
Baith linguists an computer scientists, specially thaim in the field o naitural langage processin, ettles tae pit thegither grammars that wad generate aa an juist the grammatical sentences o a leid. Whit a grammatical sentence is in an artifeicial leid, sic as a programmin leid, can be strickly defined; for normal, whit a grammatical sentence is in a naitural leid can be jaloused bi native spaekers o thon leid juist.