Why is the Potential Energy $U=mgh$ in this case? 
In the example above at instances $A$ and $C$ the potential energy is given by
$$U = mgh$$
However, Potential Energy is defined in my book as: 

Potential energy is the capacity of a system to do work

Which is a bit of a circular definition if you ask me, since the definition of work depends on energy as far as I can tell. 
Regardless, it's also mentioned in my book that the force of tension in the string is not contributing to the potential energy since it's always perpendicular to the direction of motion. 
My question is, why is the potential energy at instances $A$ and $C$ given by 
$$U = mgh$$
Shouldn't it be $U = mg\sin\theta\cdot l\theta$ or something, where $l\theta$ is the arc length?
Because only the vector component $mg\sin\theta$ is doing actual work. So going by the definition of potential energy given in my book, shouldn't that component be the only force that's considered?
Why is the whole $mg$ doing work? The $mg\cos\theta$ is also always perpendicular to the direction of motion (also cancels out with force of tension).
Something to do with conservative vs non-conservative forces I'm guessing?
 A: The vector component $mg\sin(\theta)$ is the only component doing any actual work. Your definition of "h" is $h=\ell-\ell\cos(\theta)$. This is zero when theta is zero, and raises after that. The work done is equal to the sum of the infinitesimal "force dot dx" values: $W=\int \vec{F}\cdot d\vec{r}$. 
$F$ in the direction of $d\vec{r}$ is $mg\sin(\theta)$ (imagine pushing the block up the hill/pendulum: we're applying the force in the direction of $dr$). The magnitude of $d\vec{r}$ is $\ell d\theta$. So we have: $$W=\int_0^{\theta} mg\sin(\theta')\ell d\theta'=-mg\ell\cos(\theta') |_0^\theta=mg(\ell-\ell\cos(\theta))$$
This is just $mgh=U$!
My apologies if you haven't seen many integrals yet, but it is the way the sine in the force turns into the cosine in the height, so there isn't much way around it. It just tells us that we have a bunch of little amounts of work done $mg\sin(\theta)\ell d\theta$, and we add them up to get the total work $W$.
A: The definition given by your book for potential energy is not circular. In fact, it is the expressions for energy which are derived from the general definition of work.
Now, the potential energy for a uniform gravitational field is given by $U = mgh$ where $h$ is the height in the gravitational field. This holds regardless of the constraints on the particle because, like you have mentioned, the uniform gravitational field is a conservative vector field.
