The size of the two boxes is different is not grammatically wrong, but logically wrong. If each box has its own size, then there is not one size that they share.
The sizes of the two boxes are different this is okay grammatically too, but you could mean different from what was specified, or these two boxes are different from all the other (unmentioned) boxes, which are all