>>56103092attack is double weighted in the CP formula, so it takes up a larger portion of your CP value each level up. By reducing attack to 0 you reduce the impact attack has on your CP and can squeeze out several levels extra for more bulk. Take the screenshot here as an example. The gligar on the left is the rank 1 and has 9 extra defense and 6 extra HP vs the hundo on the right. Now that does come at the cost of 4 attack, but generally that attack isn't useful.
IV's get a lot more complicated if you start caring about break and bulk points, but the general rule of thumb in pvp is to maximize bulk to survive as long as possible.
When you're able to power a pokemon up to max level, then you just want max stats