Sure, but it really doesn't have anything to do with it being in STRUCT format (I'm speaking from a Siemens perspective).
All you would do is compare the bytes, words, or doublewords one by one until you are finished. You can determine the length dynamically if you want. As for different lengths, I don't know what the point would be of measuring structs of two different lengths (they will never be equal, right?).
Another way to approach it would be to determine a checksum of each, if all you wannted to know if they were equal or not, and didn't care about what is different.