Grammar helps us understand each other with clarity and accuracy. A missing comma can completely change the meaning of a sentence:
Joe jumps, cycles, and trains.
Joe jumps cycles and trains.
In the first, Joe is engaged in a vigorous workout. In the second, he’s well on his way to being the next Evel Kneivel.
Some grammatical indiscretions can even leave your reader chuckling at the very moments they shouldn’t:
Only Mrs. Tan’s shoe shop had a generator and she opened her doors to the relief crews that brought food and water. Inside, young men from the town filled boxes with old ladies.
Of course, the old ladies weren’t stuffed in boxes during this heroic effort. But that’s what the sentence says, doesn’t it?
Proper grammar is a reflection on your attention to detail. If you can’t be trusted to put the comma properly inside a quotation mark at the end of a line of dialogue, what else can’t you be trusted to do correctly?
In these respects, grammar is as important in fiction as it is in six grade language arts. However, fiction can be enhanced by the deliberate misuse of grammar. Plenty of writers use fragment sentences to create urgency, punctuate a sentiment, or craft a distinct voice. Run-on sentences have gotten a work out in fiction, too. Faulkner wrote individual sentences that lasted pages. Jack Kerouac often used run-ons to create rhythm and momentum, creating the definitive style that is showcased in On the Road. (If you’re not sure what fragment and run-on sentences are—or the difference between lay and lie, for that matter—a good grammar book can get you up to speed.)
Throwing grammatical convention to the wind in fiction is fine, with these caveats: meaning should be clear and you have a compelling reason for doing so. Authorial laziness does not qualify.