In this paper we present a comprehensive framework for measuring similarity within and between ontologies as a basis for the collaboration across various application fields. In order to define such a framework, we base our work on an abstract ontology model that allows to adhere to various existing and evolving ontology standards. The main characteristics of the framework is its layered structure: We have defined three levels on which the similarity between two entities (concepts or instances) can be measured: data layer, ontology layer, and context layer, that cope with the data representation, ontology meaning and the usage of these entities, respectively. In addition, in each of the layers corresponding background information is used in order to define the similarity more precisely.