Around 90 percent of people diagnosed with the condition carry a pair of genes that encode for a protein called HLA-DQ2.5. Of the remaining 10 percent, most have a similar protein called HLA-DQ8. Like other kinds of 'HLA' (or human leukocyte antigen) proteins, the proteins hold pieces of fallen invaders aloft like macabre trophies on a class of immune cells, warning other defensive tissues to be on the lookout. In the specific case of HLA-DQ2.5 and HLA-DQ8, the proteins are shaped to hold chunks of gluten peptide that are resistant to digestion, instructing murderous T cells to go on the hunt.
So these proteins capture and hold gluten molecules in a way that looks like a threat to human bodies, and the immune system reacts to that. So anywhere gluten is found, the immune system goes ape shit on your body because it thinks its an imminent threat.