Answer
An ontology is a formal way of defining categories, properties, and relationships within a specific area of knowledge, and the semantic web is an effort to make information on the internet more understandable to machines using such structures.
Real-world example An ontology for the medical field might define that a symptom is related to a disease and a disease is treated by a certain medication.