Fixing $p$, what is the probability of obtaining $HH$? $P(HH | p) = p^2$
What's the probability of getting p with the initial distribuition? $f(p) = 1$ (this is the probability density function)
What's the total probability of getting HH? $P(HH) = \int_0^1{P(HH|p)f(p)dp} = \int_0^1{p^2dp}=[1/3p^3]_0^1=1/3$
And then, using Bayes' theorem: $f(p|HH) = \frac{P(HH|p) * f(p)}{P(HH)}=\frac{p^2}{1/3}=3p^2$
You can check that this is exactly the probabily density function of $B(3,1)$. More generally, if you obtain $h$ heads and $t$ tails starting with uniform distribuition, the probability distribuition become $B(h,t)$.