use something like the following:
<xsl:template match="div[@id='content']/div[position() mod 3 = 1]">
<div class="row">
<xsl:for-each select=". | following-sibling::div[position() < 3]">
<xsl:copy-of select="." />
</xsl:for-each>
</div>
</xsl:template>
<xsl:template match="div[@id='content']/div[position() mod 3 != 1]">
</xsl:template>