@tanguatlay,
I looked at this question before and couldn't provide a definitive answer. I believe that the last sentence, with two commas, is technically correct but I find the meaning of the sentence to be clear in all these examples, maybe because the sentence is so short:
- Grammatically both verbs work so it depends on what exactly you want to say.
- Grammatically, both verbs work so it depends on what exactly you want to say.
- Grammatically both verbs work, so it depends on what exactly you want to say.
- Grammatically, both verbs work, so it depends on what exactly you want to say.
I'd be inclined to form the sentence differently, though:
Both verbs work grammatically so it depends on what exactly you want to say.