I often see this type of definitions of equivalence:
Suppose that $f$ and $g$ are differentiable on $\mathbb R$. We can define an equivalence relation on such functions by letting $f(x) \sim g(x)$ if $f'(x) = g'(x)$.
So the equivalence relation is $\sim = \lbrace (h(x), h(x)) \in S^2; h'(x) = h'(x) \rbrace$ where $S = \lbrace f(x) \rbrace $ for all $f$ that are differentiable on $\Bbb R$?
Not exactly, but you're close. The relation is $\sim = \lbrace (g(x), h(x)) \in S^2; g'(x) = h'(x) \rbrace$.
It's very common to define relations in a set $X$ as
$$a \sim b \ \ \text{iff some property $P(a,b)$ involving $a$ and $b$ holds true}$$
In such a case, the relation that arises is
$$\sim= \{(a,b)\in X^2: P(a,b)\}.$$
(just to improve your mathematical notation, don't write "$S = \lbrace f(x) \rbrace $ for all $f$ that are differentiable on $\Bbb R$" but $S = \{ f(x) : \text{$f$ is differentiable on $\Bbb R$}\} $).