Matching is a technique used to control for confounding variables by ensuring that cases and controls are similar in terms of these variables. Confounding occurs when an outside factor is related to both the exposure and the outcome, potentially distorting the study's results. Proper matching can help mitigate this issue.