Difference in differences is analogous to a within-units (patients, firms, etc.) analysis, but is applied to both units that receive a treatment and units that did not. The analysis then, is of the difference between the two differences. If the treatment influences the response variable, the differences should differ, but not otherwise.
Using this technique to infer causality with observational data requires the assumption that the change in the treated group would be equivalent to the change in the untreated group, if the treatment were unrelated to changes in the response variable. This assumption might be violated, for example, if the two groups were not trending together prior to the before observation, or if an unobserved event that does affect the response happens to one of the groups within the same interval.