The ability of an organism to distinguish its own cells and tissues from those of another organism, often used in the context of immune response. Allorecognition is crucial for the immune system to identify and reject transplanted organs that are not a genetic match.