Assuming I'm understanding your setup correctly, you have an image that's essentially 2 colors. 1 is pure blue, 1 is pure red. If this is correct, you can use the effect "Set Matte." Then, for "Use For Matte" choose either the Red Channel or Blue Channel. This is telling the layer "I want you to make the alpha channel of this image the same as the Red/Blue channel of the image" in effect, making the red or blue part opaque, leaving the rest transparent.
However, this will only work if it's pure blue or pure red. Say for example that the blue part of your image is actually more of a slight Purple. If you were to look at the individual color channels, you'd see that in the Red channel, the "blue" part would show up as a very dark gray, because there is some red in there. So if there's any kind of gradient or blurring happening on the image, it'll be matted out semi-transparent in those parts. You just have to play with it.
If you're curious what a practical application for this effect is, a lot of 3D applications will render out multiple passes of an image in order to be composited together later on in something like AE (or Nuke or Fusion or what-have-you). One of those passes might be a combination of multiple things, like Ambient Occlusion, Z-Depth, etc. You can render up to 3 different grayscale images into one pass if you assign each one to a separate color channel, then use "Set Matte" to extract them later on.
Ask Brad an After Effects Question! - Forum - Site