First, you should be aware that in the sentence “I opted for helping my friend’s grammar,” the subject of the sentence is “grammar,” when you probably want it to be “friend.” To fix that, you could say “I opted for helping my friend with his grammar.” This makes friend the subject, and “with his grammar” becomes a prepositional phrase.
“I opted for helping my friend’s grammar,” or even “I opted for helping my friend with his grammar,” sounds awkward, and it would usually be best to avoid using a gerund when you could just as easily say “I opted to help my friend with his grammar.” I may be mistaken, but I believe “I opted for helping my friend with his grammar,” is technically grammatically acceptable. Still, there are better ways of saying it without using a gerund.
But if you were to use a gerund, for would be the correct preposition. “I opted for helping my friend with his grammar,” is correct.