Picture yourself learning grammar. You might imagine sitting at a desk while a teacher drones on about a bunch of things that you never had to formally study in your native language and therefore do not find necessary when learning English. Despite the bad reputation they have, there is a lot of value in formal grammar lessons. Studying grammar in a more academic manner can lead to a deeper understanding of how language works and can make you a better language learner. You might see similarities or differences in English and your mother tongue that make it easier to make connections. However, grammar lessons without real world application rarely work. You need to use your grammar inside and outside the classroom as much as possible.
Your English grammar difficulties will sometimes depend on your first language. Some students will have problems with articles, some with verb tenses and others with relative clauses. You need grammar lessons to identify your problems, and then you need practice in order to make it part of how you speak and write. In addition, there are parts of English grammar that almost everyone can agree make absolutely no sense. Phrasal verbs, gerunds and infinitives, and prepositions all come to mind. Even with these trickier elements of English you should never let yourself get discouraged. Most English speakers do not know or care what a gerund is. They use them every day, but never had to worry about memorizing a list of them. They learned them by going out into the world, copying what other people did and perfecting their language. If your goal is really to learn English grammar at a high level, you have to put in the work. That means going to class, but also using what you learned when you step out of the classroom.