Variables related to socioeconomic status (SES), including income, ethnicity, and education, shape contact structures and affect the spread of infectious diseases. However, these factors are often overlooked in epidemic models, which typically stratify social contacts by age and interaction contexts. Here, we introduce and study generalized contact matrices that stratify contacts across multiple dimensions. We demonstrate a lower-bound theorem proving that disregarding additional dimensions, besides age and context, might lead to an underestimation of the basic reproductive number. By using SES variables in both synthetic and empirical data, we illustrate how generalized contact matrices enhance epidemic models, capturing variations in behaviors such as heterogeneous levels of adherence to nonpharmaceutical interventions among demographic groups. Moreover, we highlight the importance of integrating SES traits into epidemic models, as neglecting them might lead to substantial misrepresentation of epidemic outcomes and dynamics. Our research contributes to the efforts aiming at incorporating socioeconomic and other dimensions into epidemic modeling.