The answer is language. Language is the capacity to gain and utilize complex frameworks of correspondence, especially the human capacity to do as such, and a dialect is a particular case of such a framework. The logical investigation of dialect is called linguistics.