The primary function of epithelioid cells is to participate in the formation of granulomas. Granulomas are organized collections of immune cells that form in response to persistent pathogens or irritants. Epithelioid cells contribute to the containment and isolation of these foreign substances, thereby preventing their spread. They also produce cytokines and enzymes that modulate the immune response.