Prove this holds for any pyramid with a triangular base then triangulate your polygon and sum the volumes.
More generally, if you have a closed curve in a plane and a vertex not in that plane the volume of the solid obtained by joining the vertex to the curve is going to be the integral of the sections of area parallel to the curve from it to the vertex: $\int_0^h a(t)dt$ where $a(t)$ is the area of the intersection of the solid and the plane parallel to the one which contains the curve and whose distance to the vertex is t and h is the distance from the vertex to the plane which contains the curve. By a similarity argument we obtain that $a(t)$ is proportional to $t^2$, so let $a(t)=kt^2$ then $a(h)=kh^2\implies k=\frac{a(h)}{h^2}$ so $\int_0^h a(t)dt=\int_0^h kt^2dt=\frac{kh^3}{3}=\frac{a(h)h}{3}$, the familiar formula.
The formula in the question can then be obtained by subtracting a small pyramid from a big pyramid.