We compute the spin-independent structure functions of the forward virtual-photon Compton tensor of the proton at one loop using heavy baryon chiral perturbation theory and dispersion relations. We study the relation between both approaches. We use these results to generalize some sum rules to virtual photon transfer momentum and relate them with sum rules in deep inelastic scattering. We then compute the leading chiral term of the polarizability correction to the Lamb shift of hydrogen and muonic hydrogen. We obtain -87.05/n3Hz and -0.148/n3meV for the correction to the hydrogen and muonic hydrogen Lamb shift, respectively. © 2008 The American Physical Society.