  The third real de Rham cohomology of compact homogeneous spaces is studied.
Given $M=G/K$ with $G$ compact semisimple, we first show that each bi-invariant
symmetric bilinear form $Q$ on $\mathfrak{g}$ such that
$Q|_{\mathfrak{k}\times\mathfrak{k}}=0$ naturally defines a $G$-invariant
closed $3$-form $H_Q$ on $M$, which plays the role of the so called Cartan
$3$-form $Q([\cdot,\cdot],\cdot)$ on the compact Lie group $G$. Indeed, every
class in $H^3(G/K)$ has a unique representative $H_Q$. Secondly, focusing on
the class of homogeneous spaces with the richest third cohomology (other than
Lie groups), i.e., $b_3(G/K)=s-1$ if $G$ has $s$ simple factors, we give the
conditions to be fulfilled by $Q$ and a given $G$-invariant metric $g$ in order
for $H_Q$ to be $g$-harmonic, in terms of algebraic invariants of $G/K$. As an
application, we obtain that any $3$-form $H_Q$ is harmonic with respect to the
standard metric, although for any other normal metric, there is only one $H_Q$
up to scaling which is harmonic. Furthermore, among a suitable
$(2s-1)$-parameter family of $G$-invariant metrics, we prove that the same
behavior occurs if $\mathfrak{k}$ is abelian: either every $H_Q$ is
$g$-harmonic (this family of metrics depends on $s$ parameters) or there is a
unique $g$-harmonic $3$-form $H_Q$ (up to scaling). In the case when
$\mathfrak{k}$ is not abelian, the special metrics for which every $H_Q$ is
$g$-harmonic depend on $3$ parameters.
