Is grammar the way words are formed and the way "correct English" is achieved and syntax just sentence types? And does grammar rule over syntax i.e. do we need correct grammar to create a sentence type (or syntax) They seem quite similar to me. On my English Language specification, word classes, sentences, and phrases all fall under grammar therefore has confused me.
There is no general agreement about how or whether to distinguish these terms. In some discussions, I use them interchangeably. My preference is to make a distinction between "grammar" and "syntax" parallel to logicians' terms "morphology" and "logical syntax", where grammar tells you what sentences are in a language and syntax tells you about the relations among those sentences (such as paraphrase). This is my understanding of the way McCawley uses the terms in TSPE (and he disparages the study of "grammar").
In the agent forms, "grammarian" tends to be reserved for amateurs who have come to regard themselves as arbiters of some sort on style and usage, while "syntactician" refers to professional descriptive linguists.
Within linguistics this term has several specific usages.
It can be used to refer to the knowledge within the human brain that enables the production and comprehension of a particular language, so we talk about children acquiring the grammar of a language.
It can refer to the total set of ‘rules’ that have been described for any particular language, so includes phonology, morphology, syntax, etc. When linguists try to document this set of rules (usually based on a collection of utterances in the target language, from which these rules are inferred) they are said to be describing the grammar of a language. Based on this, 'grammar' is often used to refer to a text (typically a book) that presents (a substantial subset of) these ‘rules’ for a particular language.
The term 'grammar' is often used by non-linguists to refer very generally to the rules of a language, often thought of in prescriptive terms as 'good' and 'bad' grammar, and also often including the writing system, punctuation, etc.
This term is used within linguistics to refer to the structure of linguistic utterances, in particular the sequencing or ordering of elements. In relatively isolating languages such as Chinese the syntax is a large part of the grammar but in relatively non-isolating languages (eg Australian languages) syntax is far less important, with morphology playing a larger role.
So syntax is a subset of grammar, at least as those terms are used by linguists.
: Eg ‘A grammar of Awa Pit’, ‘A short grammar of East Circassian’, ‘Yulparija sketch grammar’, etc.