It’s kind of a difficult line to draw. If you’re a perfectionist worrying about writing a perfect first draft, you’ll never get anywhere. But Stephen King in his On Writing refers to grammar as one of the tools in your toolbox (one among several). Saying you shouldn’t pay attention to grammar is a bit like saying you’ll build a house with a broken hammer.
Homonyms are what slip in for me as hard as I try to watch for them. I know the difference in to and too or your and you’re but when I’m concentrating on getting the story down, sometimes my fingers don’t. Small errors can and will be fixed in an edit, but if there are serious faults in the grammar, it’s going to be difficult if not impossible to fix. That leaves open to question where the line is between small errors and serious problems. LOL
I’d say you should make the grammar as good as you can without obsessing over it.