Semantics in linguistics is a subfield of the study of language which focuses on meaning. Semanticists examine how words, phrases and sentences combine in ways that are acceptable to language users, observing that appeals to grammaticality alone cannot explain these. For example, the sentence Mary will arrive tomorrow is both grammatically and semantically acceptable, but !Mary arrived tomorrow[1] is semantically nonsensical while syntactically grammatical. The field also examines how sentences that are grammatically very different can nevertheless be semantically equivalent, such as Bill sank six pints last night versus Bill drank half-a-dozen beers yesterday evening, and how language users can recognise ambiguity in sentences such as Visiting relatives can be difficult.[2]
Semantics in linguistics is related to pragmatics, but is distinct in that semantics involves actual linguistic knowledge, whereas pragmatics concerns knowledge outside language. For example, the sentence Bill's been to Paris is semantically and grammatically fine, but anyone encountering that sentence would have to refer to context or other information they know or could predict about Bill to be able to completely understand the significance of the sentence. For example, listeners may be expected to express surprise at this news because they know that Bill is a francophobe, or they may have believed that Bill had intended to visit London rather than the French capital. This kind of information is outside linguistic semantics, which instead focuses on meaningful relations between lexical items: listeners need know nothing about Mary in the sentence !Mary is a widower in order to rule it unacceptable, for instance, because there is a clash of word meaning in the link between Mary and widower. Pragmatic knowledge, on the other hand, might lead speakers to recover an acceptable, though rather odd, meaning: Mary might have once been a woman, who changed her sex but not her name, and also married a woman she now survives.