**I am hoping that there is a generalization of Birkhoff's theorem that applies not only to algebras (in the sense of Birkhoff's paper) but also to algebras that satisfy certain equational identities (such as cancellative semigroups).**<p>

There is a version of Birkhoff's Theorem that applies to quasivarieties, such as the quasivariety of cancellative semigroups, but it doesn't give you what you are asking for here. Namely, if $\mathcal{Q}$ is a quasivariety and $\mathbf{A}\in \mathcal{Q}$, then call $\theta$ a $\mathcal{Q}$-congruence on $\mathbf{A}$ if $\mathbf{A}/\theta\in \mathcal{Q}$. The $\mathcal{Q}$-congruences on $\mathbf{A}$ form an algebraic lattice, and that is enough for the
'$\mathcal{Q}$-version' of Birkhoff's Theorem to hold: every algebra in $\mathcal{Q}$ is a subdirect product of '$\mathcal{Q}$-subdirectly irreducibles'. An algebra $\mathbf{S}\in \mathcal{Q}$ is $\mathcal{Q}$-subdirectly irreducible if it has a least nonzero $\mathcal{Q}$-congruence. In particular, every cancellative semigroup is a subdirect product of cancellative semigroups that are subdirectly irreducible relative to the class of cancellative semigroups.<p>

But a $\mathcal{Q}$-subdirectly irreducible might not be subdirectly irreducible in the absolute sense, so this doesn't answer the question that you asked. Let me at least give an affirmative answer to the commutative version of your question.<p>

**Claim.** If $S$ is a commutative cancellative group, 
then $S$ is a subdirect product of subdirectly irreducible cancellative semigroups. (In fact, $S$ is a subdirect product of subdirectly irreducible abelian <b>groups</b> considered as semigroups.)<p>

**Reasoning.** Embed $S$ in its universal group $U$, which is an abelian group.
For each $a\neq b$ in $S$ ($\subseteq U$), choose a group congruence $\theta$ on $U$ that is maximal for $(a,b)\notin \theta$. The group $U/\theta$ is a subdirectly irreducible abelian group, hence it is isomorphic to a subgroup of some Pr&uuml;fer group $\mathbb Z_{p^{\infty}}$. The composite map
$f_{a,b}\colon S\to U\to U/\theta\to \mathbb Z_{p^{\infty}}$
separates $a$ and $b$ and has image $f_{a,b}(S)$
that is a subsemigroup of
$\mathbb Z_{p^{\infty}}$. Every subsemigroup of
$\mathbb Z_{p^{\infty}}$ is a subdirectly irreducible group
that is also subdirectly irreducible as a semigroup.
Thus, $\prod f_{a,b}\colon S\to \prod f_{a,b}(S)$ represents
$S$ as a subdirect product of subdirectly irreducible abelian groups. \\\\\\