The concept of ontology is derived from the realm of philosophy. For our purposes, we embrace the definition of an ontology as "a formal naming and definition of the types, properties, and interrelationships of the entities that really or fundamentally exist for a particular domain of discourse" (courtesy Wikipedia).
In an ontology, we at least can expect these components: classes, attributes and relationships. But many ontologies also contain rules, axioms, events or restrictions.
As the definition expresses, an ontology is basically a map of (some section of) reality. A good example of an ontology is the Foundational Model of Anatomy. This ontology contains approximately 75,000 classes and more than 120,000 terms; over 2.1 million relationship instances from over 168 relationship types link the FMA’s classes into a coherent symbolic model.
An ontology contains relationships, rules et cetera that allow us to navigate through this model. For this particular purpose, a number of languages were developed. A commonly used one is OWL, the Ontology Web Language.