I learned a good deal of grammar in my French immersion school in the early 70s. Of course, that was in French. When I went to Japan and began teaching English, I had a number of basic concepts, but was often at a loss to understand and explain many points. I picked up some more grammar by staying one step ahead of the students in the various textbooks like that one they (used to?) use at Nova. Still, these were not really grammar textbooks per se and what I picked up there was limited.
My first two real grammar books for teachers were Michael Lewis's The English Verb and A Teacher's Grammar: An Approach to the Central Problems of English by R. A. Close, which I just stumbled across during my regular browsing at Kinokuniya.
Later I took Temple University's M.Ed. which includes a course called New Grammars taught by Ken Schaefer. Ken took us through more traditional grammatical analysis, including sentence diagramming, and introduced us to Chomskyan transformational grammar with grammar trees and all that. The main text was The Grammar Book
Since then, I have added to my collection the Longman Grammar of Spoken and Written English
Finally, whenever there is a grammar question, I do my best to track down an answer and explain it. You learn a great deal teaching others.