The branch of immunology that deals with the specific responses of the immune system to invading pathogens.