Syntax is the study of the relationships between words, phrases, and clauses. For example, trying to determine if a word is adjectival or adverbial and which word it is modifying is doing syntax. It is the counterpart of doing lexical work which is working with words and their meaning.
Sentence diagramming is simply syntax made visible.
See also the principles of Greek syntax.