Cospectrality of multipartite graphs