"Form" and "function" are often contrasted in English.
Contrasting or relating these goes back to Aristotle. Most concretely, "form" just means shape. More abstractly, Aristotle explained how it's possible for a thing to change and still remain itself by saying that its matter stays the same as it takes on a new form. To this day, when we want to talk about ways in which the "same" thing—like a word—can be different, we speak of the "forms" of that thing. There are many different "forms" of democracy, "forms" of web site, "forms" of music, etc.
Aristotle also talked a lot about the "function" of the various parts of plants and animals. One of the central ideas of his philosophy is that form and function go together: the forms of the parts of organisms are explained by the functions they serve. In other words, the role or purpose—the function—that a part serves in the life of the organism explains its shape and design—its form. Some teeth are sharp, for cutting; some are shaped for grinding; the fingers are jointed and placed so they can work together to manipulate objects; etc.
"Form follows function" became a well-known motto of 20th-century architecture. The idea is that the design and shape of a building—its form—should reflect its function, and not useless ornaments or traditional frills.
So, to answer your question, when people speak of "form" in grammar, they can mean a lot of different things. The "forms" of a noun are the specific words that indicate case and number: for example, in English, "I" and "me" are sometimes called "forms" of the same word, as are "pen" and "pens"—the singular form and the plural form. English verbs have up to five forms, illustrated by show, shows, showed, shown, and showing.
All the forms of the same word are sometimes called its morphology—from morphe, the Greek word used by Aristotle that was translated in ancient times into the Latin forma. Syntax is the way the sequence and forms of words are chosen in a sentence, sequence being easily considered another kind of "form". Some people speak of sentence forms: declarative, interrogative, or imperative; or simple, complex, compound, and compound-complex. The -tion morpheme takes one "form" in position and another "form" in transmission. People call upon the word "form" in grammar to mean pretty much any way that a single, underlying element of words or sentences can appear differently in different situations.
In general, grammar is concerned with how the forms of words and sentences express meaning, distinct from the meanings of the individual words—for any reasonable use of the word "form" in regard to words and sentences. For example, the difference in meaning between "I see him" and "He sees me" is purely grammatical. Both sentences have "the same" words but the words are in different forms and the sentences have different forms, resulting in different meanings.