I think I answered a very similar question recently, but I haven't located it. Please excuse any repetition.
I use grammar as the counterpart to logicians' term morphology, which means an account of what sentences (well-formed formulas) are in a language. I'd use the term morphology for that, as logicians do, except linguists have preempted the term morphology to mean something different -- an account of word structure. I believe my use of the term grammar is completely in accord with McCawley's use, in The Syntactic Phenomena of English. (But McCawley thinks grammar, in that sense, is not useful and is not interesting. Whilst I, on the other hand, am a grammar lover.)
I use syntax to mean the same thing that logicians, and McCawley use it for. It's an account of the relationships of sentences to other sentences, excluding truth and reference (which is semantics). I suppose there could be other relations of significance, but really that boils down to an account of logical implication based on the forms of sentences, which is called logical syntax (to distinguish it from logical semantics). I think it is fair to say that McCawley's interest is in logical syntax.
In these senses, syntax presupposes grammar, because until you know what the sentences are, how can you study implicational relations among them?
I think the use in linguistics of these two terms grammar and syntax, though, has been all over the map.