I think the following might be a simpler method:
expr1 = xy + Subscript[x, 1] Subscript[y, 1] +
Subscript[x, 2] Subscript[y, 1] + Subscript[x, 1] Subscript[y, 2] +
Subscript[x, 2] Subscript[y, 2] + Subscript[x, 1] Subscript[y, 3] +
Subscript[x, 2] Subscript[y, 3];
expr2 = x - y + (Subscript[x, 1] - Subscript[y, 1]) (Subscript[x, 1] -
Subscript[y, 2]) + (Subscript[x, 2] - Subscript[y, 1]) (Subscript[
x, 2] - Subscript[y, 2]) + (Subscript[x, 3] - Subscript[y,
1]) (Subscript[x, 3] - Subscript[y, 2])
rule = k_. Subscript[_, a_] Subscript[_, b_] /; a == b :> Sequence[];
Then for expr1:
expr1 /. rule
xy + Subscript[x, 2] Subscript[y, 1] +
Subscript[x, 1] Subscript[y, 2] + Subscript[x, 1] Subscript[y, 3] +
Subscript[x, 2] Subscript[y, 3]
And for expr2 (I'm not sure how you want to handle the Powers):
Expand[expr2] /. rule
x - y +
\!\(\*SubsuperscriptBox[\(x\), \(1\), \(2\)]\) +
\!\(\*SubsuperscriptBox[\(x\), \(2\), \(2\)]\) +
\!\(\*SubsuperscriptBox[\(x\), \(3\), \(2\)]\) -
Subscript[x, 2] Subscript[y, 1] - Subscript[x, 3] Subscript[y, 1] -
Subscript[x, 1] Subscript[y, 2] - Subscript[x, 3] Subscript[y, 2] +
3 Subscript[y, 1] Subscript[y, 2]