This transformation:
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output omit-xml-declaration="yes" indent="yes"/>
<xsl:strip-space elements="*"/>
<xsl:template match="node()|@*">
<xsl:copy>
<xsl:apply-templates select="node()|@*"/>
</xsl:copy>
</xsl:template>
<xsl:template match="Com[FileName/@Source='My.Exe']"/>
<xsl:template match="CompRef[@Id=/*/*/*/Com[FileName/@Source='My.Exe']/@Id]"/>
</xsl:stylesheet>
when applied on the provided XML document (corrected to be made well-formed):
<Frags>
<Frag>
<DirRef Id="BeemzDir">
<Com Id="BEED24F05AB78FB588F61D4092654B6D" Guid="{A11AB356-2F45-4157-92EF-ED49F5BE0F70}">
<FileName Id="fil1" KeyPath="yes" Source="My.Exe" />
</Com>
<Com Id="FFF24F05AB78FB588F61D4092654CCC" Guid="{A11AB356-2F45-4157-92EF-ED49F5BE0F70}">
<FileName Id="fil2" KeyPath="yes" Source="My.Dll" />
</Com>
</DirRef>
</Frag>
<Frag>
<ComGroup Id="MyGroup">
<CompRef Id="BEED24F05AB78FB588F61D4092654B6D" />
<CompRef Id="FFF24F05AB78FB588F61D4092654CCC" />
</ComGroup>
</Frag>
</Frags>
produces the wanted, correct output:
<Frags>
<Frag>
<DirRef Id="BeemzDir">
<Com Id="FFF24F05AB78FB588F61D4092654CCC" Guid="{A11AB356-2F45-4157-92EF-ED49F5BE0F70}">
<FileName Id="fil2" KeyPath="yes" Source="My.Dll"/>
</Com>
</DirRef>
</Frag>
<Frag>
<ComGroup Id="MyGroup">
<CompRef Id="FFF24F05AB78FB588F61D4092654CCC"/>
</ComGroup>
</Frag>
</Frags>