Purpose of a capacitor between op amp inputs in buffer circuit

At DC, and low frequencies where the gain and speed of the amplifier is sufficient to keep its inputs at more or less the same voltage, it does nothing, as it's 'bootstrapped out'.

Any amplifier has a finite bandwidth. If a high speed step is applied to the input, then for a moment, there will be the full step voltage across the inputs. Some op-amps misbehave under these conditions. A small capacitor across the inputs like this reduces that effect.

In circumstances where there is RF pickup on the input leads, which can also make op-amps misbehave, a small capacitor here can also improve things.

Most applications of op-amps do not have very high speed inputs, so do not need this protection from them. It's usually better to explicitly filter any inputs, rather than use this crude method. However, in the case of an emergency retro-fit, putting a small C directly across the inputs is a convenient improvement.

Such a capacitor between both inputs (very often, in series with a small resistor) is a kind of external lag compensation. This is a simple method to stabilize an opamp (with strong feedback) that is not unity-gain compensated. The explanation is simple: For rising frequencies the feedback factor is reduced and, hence, the tendency to oscillate is reduced. As a consequence of this compensation method, the usable closed-loop bandwidth is reduced considerably.

This kind of compensation can an also be used for unity-gain compensated opamps with strong feedback to improve the phase margin (step response with smaller overshoot)