Hi,
The task you are referring to is one of the subtasks in the GLUE benchmark 3 (which is an important benchmark in NLP): the CoLa dataset 1 (CoLa is short for Corpus of Linguistic Acceptability). This is a simply binary classification task: given a sentence, the model needs to determine whether the sentence is grammatically correct or not.
Hence, you can use a BERT model (or one of its variants, such as RoBERTa, DistilBERT, etc.) fine-tuned on this dataset. This is already available on the hub, for example this one 7.