In general, semantics (from the Greek semantikos, or "significant meaning," derived from sema, sign) is the study of meaning, in some sense of that term. Semantics is often opposed to syntax, in which case the former pertains to what something means while the latter pertains to the formal structure/patterns in which something is expressed (e.g. written or spoken).
Several more particular senses of the word can be identified:
Semantics is a subfield of linguistics that is traditionally defined as the study of meaning of (parts of) words, phrases, sentences, and texts. Semantics can be approached from a theoretical as well as an empirical (e.g. psycholinguistic) point of view. The decompositional perspective towards meaning holds that the meaning of words can be analyzed by defining meaning atoms or primitives, which establish a language of thought. An area of study is the meaning of compounds, another is the study of relations between different linguistic expressions (homonymy, synonymy, antonymy, polysemy, paronyms, hypernymy, hyponymy, meronymy, metonymy, holonymy, exocentric, and endocentric). Semantics includes the study of thematic roles, argument structure, and its linking to syntax. Semantics deals with sense and reference, truth conditions and discourse analysis. Pragmatics is often considered a part of semantics.
In mathematics and computer science
"Semantics" is also used as a term in mathematics and computer science.
Many of the formal approaches to semantics applied in linguistics, mathematical logic and computer science originated in techniques for the semantics of logic, most influentially being Alfred Tarski's ideas in model theory and his semantic theory of truth. Also, inferential role semantics has its roots in the work of Gerhard Gentzen on proof theory and proof-theoretic semantics.