Comparative anatomy is the study of the anatomy of different species of animals. Scientists compare the differences and similarities between the body structures and genetic information of the animals in order to study the way the animals have adapted to the environment during the periods of evolution, or, in other words, to examine how they evolved. Thus, comparative anatomy is very important to the study of evolution, and it's actually very closely related to evolutionary biology.
One of the main purposes of comparative anatomy is to examine if certain species of animals share or don't share a common ancestor. When animals are related due to common ancestry, they might have body structures that are similar or have a similar purpose—these are called homologous structures.
Analogous structures are the similar body structures in unrelated animals that developed in a similar way because they essentially serve the same purpose. For example, humans and whales have similar body structures: a human arm has similarities with the flipper of a whale, because these species share a common ancestor. While bats and birds aren't related (bats are mammals and birds are Aves), but they have body structures (wings) that are similar because they have the same function.
Comparative anatomy also helps scientists with the classification of animals.