Generally speaking, you could either apply a Mantel-Haenszel test for whether the impact of the exposure factor differs between groups A and B (basically a stratified chi-squared test), or almost equivalently, model with Poisson regression and include an interaction term between exposure and group status to test whether these differ. (EDIT: I mean whether exposure differs by group here too)
Wikipedia is (for once) not very verbose on this subject, but does give a two-liner summary. http://en.wikipedia.org/wiki/Cochran%E2%80%93Mantel%E2%80%93Haenszel_statistics