What is the definition of the slope of a curve at a point x=a?

Formal definition of a derivative?
or slope between two points?

the slope at a point a is the slope of the line tangent to the curve at x=a.

To get that, pick a point number b, near a, and think of the slope between two points on the curve at f(a) and f(b).

As b gets closer and closer to a, the line between the two points gets closer and closer to the tangent line.

Finally, when b=a, the two points are the same point, and the line is tangent to the curve.

That's all the formal definition of the derivative is. It's the limit of the slope of a line joining two points on the curve, as the two points get closer and closer to each other.