Learning the grammar of a language will enable you understand how sentences are constructed and to construct your own sentences. Without a knowledge of grammar all you can do is learn individual words and phrases. Don't assume that the grammar of your L2 will be the same as your L1. No two languages have exactly the same structure.
You don't have to have a overt knowledge of the grammar or grammatical terminology of your L2 in order to speak it, as long as you can use the grammar effectively.
Learning to arrange the words in the correct order is probably one of the most important and useful things you will learn, after pronunciation and vocabulary. If you manage to use the right words in the right order you should be understood even if you cannot remember all the necessary grammatical endings. Arranging the words of your L1 in the same way as your L2 will help you to understand how your L2 works.
The basic word order of languages is described using three words: subject (S), verb (V) and object (O). English, for example, has SVO words order, meaning that the subject usually comes first in a sentence, followed by the verb, then the object. About 42% of the world's languages use this word order.
An even more popular word order is SOV, which is used by 45% of the worlds languages, including German, Hindi, Japanese, Korean and Turkish. Other words orders are far less common: VSO is used by 9% of languages, VOS is used by 3% of languages, OVS is used by 1% of languages, and OSV is used very few languages.
Examples of word order:
Key: S = subject, V = verb, O = object
In many languages nouns, adjectives and other words can change in various ways to indicate their role in a sentence. Verbs can change to indicate who is performing the action (person), how many people are invovled (number) and when the action is taking place (tense). Some languages make further distinctions, while in others words don't change at all.
One way to get used to the shape shifting is to take a sentence or longer text in your L2 and to practise changing the tense, number and/or person. For example, if we take the sentence "The monkey is in the tree" we could change the tense: "The monkey was/will be/would be/has been/had been in the tree", or the number: "The monkeys are in the tree". You could also change the verb, e.g. "The monkey is sitting/is swinging in the tree", the person. e.g. "You are/I am/We are in the tree", and apply many other transformations to the sentence.
After a lot of practice, you'll be able to manipulate the grammar of your L2 without having to stop and think about it all time. If you find yourself stumbling over particular tenses or other patterns, focus on them until they become automatic.
An alternative way to acquire an ability to use grammar in your L2 is to learn lots of sentences from as many different sources as possible. The idea is that you absorb the grammatical patterns and vocabulary from the sentences without making a conscious effort to learn them. You also learn these things in context, which shows their usage. You could use flash cards and/or a spaced repetition system such as Mnemosyne to learn the sentences.
This method is discussed and explained at:
All languages have regular and irregular grammatical patterns and it's generally easier to learn the grammar of languages with few irregularities, such as Finnish, Turkish and Japanese, than those with more irregular grammar, such as English or Greek.
Focus on learning the regular grammatical patterns and look/listen out for examples of them when reading or listening to the language. Also look out for regular constructions in the language and try to guess what they mean from the context. If that fails, look them up or ask somebody. Practice using what you learn as often as possible.
You will probably be understood if you apply regular grammatical patterns to all relevant words, even the ones that would normally behave irregularly. However it is often the most frequently-used verbs, such as the verbs to be, to have or to do, which behave irregularly so you will need to learn some irregular grammatical constructions.
All languages have some built-in redundancy, for example in Spanish "the friends" is los amigos: the plural is indicated by both the form of the definite article, los, and the ending on the noun, amigos. Even if you forget to make one of these plural you should still be understood.
Many languages divide nouns into different genders. English has the remnants of a three gender system which determines the choice of pronoun (he, she, it, his, hers, its, etc) and is usually related to the sex. In French, Spanish and Italian nouns are either masculine and feminine. In German there are three genders masculine, feminine and neuter. The way genders are assigned to nouns is largely arbitrary.
In Italian it's easy to determine the gender of a noun: if it ends in 'o' it's masculine, if it ends in 'a' it's feminine, but if it ends in 'e' it could be either. In other languages there are a few rules you can use to determine gender, usually based on the endings of the nouns, but there are many exceptions to these rules.
One way to learn the gender of nouns is to visualise a familiar place, such as your home town, and to divide it into two, three or however many genders there are in your L2. Then picture nouns of one gender in one part of town and nouns of another gender in a different part of town.
Another way to memorise genders is to associate nouns with adjectives which change to show the gender. For example, petite plume (small feather) - feminine, petit arbre (small tree) - masculine.
One good way to improve your knowledge of grammar is with the TeachMe! series of language courses. They include many exercises to practice your grammar at a range of levels.
Links to a wide range of online grammar resources and language courses
Verbix - online verb conjugator for languages from Afrikaans to Welsh
Verbulix - vocabulary and conjugation trainers for English, German and Spanish
If you need to type in many different languages, the Q International Keyboard can help. It enables you to type almost any language that uses the Latin, Cyrillic or Greek alphabets, and is free.
Note: all links on this site to Amazon.com, Amazon.co.uk and Amazon.fr are affiliate links. This means I earn a commission if you click on any of them and buy something. So by clicking on these links you can help to support this site.