The second syllable of syntax is a clue to its relationship to the word 'tactics'. It's the order that you put words in, much as a tactician deploys troops for various effects.
'Grammar' has widely differing meanings - particularly descriptivist (the way things are in fact) and prescriptivist (the way someone thinks things should be.