Grammar by itself is a vast subject. However, for GMAT, you do not need to know all the Grammar rules. If you are not enrolling for a GMAT course, then a good strategy to prepare for the Sentence Correction section of GMAT e is to carefully analyze the SC questions in the Official GMAT Guides and look for rules that are tested, correct idioms that are used, and syntax errors that need to be rectified.
Alternatively, pick up a good Grammar book and review the rules for Pronoun usage, Modifier usage, Parallelism, Errors in Comparison, Agreement between Subject & Verb, Correct use of Tenses including the Perfect Tenses, and subjunctive Mood. These rules cover most of the concepts tested on SC in GMAT.