In theory, yes, this is possible. In practice, it would be a rare thing to encounter, just because the laws of nature can be fickle and somewhat unpredictable. I'm going to call the planet your animation shows as Earth as PB1 (Planetary Body 1). I'm also going to call the Mars one PB2, and the Moon one PB3.
There are some important bits, though:
- The Roche Limit: In short, the Roche Limit describes how close two planets can get before gravitational forces tear one or the other apart. Obviously, this mostly applies to PB2 and PB3, but also applies to PB1 and the paired PB2+PB3 system.
- The distance between PB1 and PB2+PB3 must be sufficiently large, so that PB2+PB3 stay in their orbits around each other. This allows us to say that the TB2+TB3 system acts like one big planetary body. I'll call this hypothetical planet of equal mass "J".
- Once the "J" system is sufficiently far away, the PB1+J system can be modeled just like any planet with a satellite. In fact, J can be more massive than the PB1, it just depends on how you like your
sandwiches planetary systems. This means, in terms of mass, PB3=PB1>PB2 can happen. PB2>PB3>PB1 can also happen. According to your animation, though, you're looking at PB1=J.
You can fool with a planetary orbit simulator, like the one here, or here, or here, to find out how difficult it is to set up. (It's even harder to set up, say, a horseshoe orbit.)
Cem Kalyoncu messed around with the second simulator, and found some nice settings for your planetary system:
PB1: Mass: 200, Location: 150, 0, Speed: 0, 133
PB2: Mass: 100, Location: -100, 0, Speed: 0, -105
PB3: Mass: 100, Location: -50, 0, Speed: 0, 105
Thanks Cem Kalyoncu!