The grammar of Portuguese is similar to that of other Romance languages, and quite close to Spanish grammar. It has similar features, like the subject-verb-object word order, and gender and number agreement for nouns and adjectives. It follows many of the same rules for the creation of tenses, and for forming commands.
Unlike Spanish, Portuguese has preserved a number of features of Vulgar Latin, particularly in the verb conjugations. It maintains the familiar and formal forms of address, in both singular and plural, but adds a superformal mode of address called "o senhor." There is no personal "a" in Portuguese. Other features that make Portuguese grammatically different from Spanish are certain variations for forming the future and conditional tenses, a special use of the perfect tenses, the retention of the future subjunctive, and the personal infinitive.
The "o senhor" form. In addition to "você," which is a third person singular, polite way of addressing another, Portuguese has maintained the third person indirect form of address for formal occasions. In parts of Brazil and Portugal to this day, some children are raised to use this formal form with their parents, and certainly with the elderly relatives. It is also used commonly in business, and in discussions and conversations with dignitaries, judges, politicians and other celebrities where a show of respect is required. It is employed a bit like "sir" in English, which has, after all, a similar etymology. In Brazil the form is preserved in the upper social strata, but increasingly it has given way to "você" among the youth, particularly in schools and colleges. The feminine form of "o senhor" is "a senhora." One might, for example ask an elderly female acquaintance, "Como vai a senhora?" - literally, "How does it go (for) the lady?" A related, and even more exalted formality is "Vossa Senhoría," which is abbreviated in business prose to "V.Sa." and is used for very formal commercial or political communications. Literally it means "your lordship." In Portugal and in the south of Brazil, the "tu" form continues in use within families and circles of intimate friends. Elsewhere in Brazil, "você" is used as the all-purpose "you," somewhat the way it is employed in English, except when "o senhor" would be required.
The formation of conditional and future tenses permits, optionally, the insertion of the object pronouns (direct or indirect) in between the root of the verb and the inflection. The pronoun is set off by hyphens. For example, "I shall give it to him (or her or formal you)" could be "O darei a ele (ou ela ou você)." It equally could be "O dar-lhe-ei." (Good form in Portuguese involves not having a direct and indirect pronoun side-by-side, so the first example uses a prepositional phrase in lieu of the indirect object pronoun.) Jânio Quadros was briefly the president of Brazil in 1961 and a Brazilian politician renowned for his eloquent elocution and command of Portuguese. He was also well-known for his fondness of drink. When asked critically by an abstemious old woman why he was so given to drink, he famously replied, "Bebo-o porque é líquido; fora ele sólido, comê-lo-ïa." ("I drink it because it is liquid; were it solid, I would eat it.") Thus illustrating for all time the construction of the conditional tense with the object pronoun.
Another unusual feature of Portuguese is that the perfect tenses do not refer to action that has ended in the past, but rather to action that has been continuing. The simple past (preterit) and imperfect are used for those other purposes, more so than in Spanish. The perfect tenses are formed with "ter" ("tener" in Spanish) instead of "haber." "Tenho chamado" means literally, "I have called" but it is used to mean "I have been calling," "Têm comido" does not mean "they have eaten" but rather "they have been eating," as in "they have been eating their meals regularly." For the first meaning, Portuguese would just say "comeram" - they ate.
The future subjective is formed by the preterit stem plus "ar," "er," or "ir" according to the conjugation. Thus, for regular verbs it looks like the infinitive. "Ser" forms "for" as its future subjunctive, and a few other irregularities confuse foreigners from time to time (like "vier" for "vir" and "vir" for "ver.") Any reference to any action that has not already completed is considered dubious, and thus in the future subjunctive. "If God wills . . . " is "Se Deus quiser." Why? Because it has not happened yet. In Spanish, one says "be that as it may [be]" by using the expression "haya lo que haya" - let whatever there is be whatever there is. In Portuguese the second "haya" is in the future, as we don't know what will give with it. So the expression is "haja o que houver." "If I win" becomes "Se eu ganhar" (future subjunctive).
Another interesting aspect of Portuguese grammar is the personal infinitive. In Spanish, the infinitive is never inflected. Sometimes, it might take on a pronoun or two, as in "hablárselo" meaning "to speak to him (or her) [about] it." But the infinitive does not change according to the actors doing whatever the infinitive is talking about. In Portuguese, it can. For example, "hear them sing" (imperative) would be "ouça eles cantarem." The "cantar" is an infinitive, but adds the "-em" because "they" are the ones singing. "It's a polite gesture to leave" would be "Ë cortesia sair," in an indefinite way, but if "we" are the ones being polite, the expression would be "Ë cortesia sairmos." A subjunctive phrase can often be used instead (as in this last example). It would be the approach taken in Spanish; however, this infinitive shortcut is available in Portuguese.
Finally, one might see in the "useful phrases" below the question, "Where is the bathroom?" It is translated "Onde é o banheiro?" Portuguese makes the same distinction as Spanish does between "ser" and "estar" as two different verbs meaning "to be." The first is for inherent traits - essences of the thing, if you will - and the second is for temporary conditions and locations. Unlike Spanish, however, the permanent location of something is considered part of its "essence," and hence "ser" is used for the location of things that do not move. Buildings and parts of buildings are going to be where they are right now for a very long time, and hence "ser" is used with "onde" (meaning where), if (and only if) the thing being located is immovable.