No. You misunderstand what diff does, and why diff is used there.
diff, when applied to a numeric vector, forms the difference between successive elements. This is NOT a derivative.
All it did was compute the difference between pairs of successive elements. We can get the same result by the operation:
dx_2 = X(2:end) - X(1:end-1)
Again, this is NOT a derivative. Your confusion stems from the fact that diff can also be used to perform differentiation, when applied to a symbolic expression. And that is where syms comes in. For example:
So x is a symbolic variable. It contains no numerical value here.
As you can see, differentiation of an expression was performed. In both cases, a function named diff was used, but they do entirely different things, depending upon the input arguments.