It computes the difference between pairs of consecutive elements.
Let's say temp are observations of some variable, for example temperature readings taken on the hour. Then diff(temp) will tell you how much the temperature has changed during every hour.
The opposite of diff() is cumsum() (cumulative sum):
> temp
[1] 10 1 1 1 1 1 1 2 1 1 1 1 1 1 1 3 10
> cumsum(c(10, diff(temp)))
[1] 10 1 1 1 1 1 1 2 1 1 1 1 1 1 1 3 10