What you are confusing here is speed and velocity. Light speed is constant, but the velocity, which takes into account the direction as well as the speed is not. As an example of how something can accelerate without changing speed, consider the case of circular motion, where the acceleration of an object moving at a speed $v$ in a circle of radius $r$ is $a=v^2/r$. In this case, the speed is constant, but the velocity is changing constantly. Gravity can also cause light to change its direction, and therefore its velocity. But the speed of light will remain constant in all reference frames. Its the law :)