No Changes To Collision Filter
As you say, you cannot change the collision filter parameter on a physics body once it has been created. To clarify what this means, consider this example of the use of the filter from the Corona SDK documentation on Collisions (which also explains very well the use of categoryBits and maskBits):
local floorCollisionFilter = { categoryBits=1, maskBits=6 }
local floor = display.newRect( 0, 0, 320, 80 )
physics.addBody( floor, "static", { filter=floorCollisionFilter } )
After the physics body is instantiated, changes to floorCollisionFilter will have no effect on the collision properties of floor.
Precollision Detection
You can, however, change the collision behaviour of objects using preCollision detection. If you have a preCollision listener on your objects, you can determine if they should be involved in the collision event that is being triggered and set the event.contact.isEnabled = false if they should not. There are gotchas: this can be costly if you have many physics bodies and the precollision calls can be noisy (many possible calls per collision event).
Multi-Element Body and isBodyActive Property
Maybe you should reconsider how you are adding physics to the curved line. You say you are placing many circles along a path (like a string of beads/pearls) to detect collisions between that path and other bodies. If the shape of the path does not need to change, you should consider using an edge shape (chain) body. There do not seem to be limitations on the number of vertices used in creating it or convexity requirements (unlike polygonal bodies).
This would allow you to remove the edge shape body (assume it is called object) from the simulation (other bodies will ignore/pass through it) by setting object.isBodyActive = false. This won't remove the object from the display and you can always set isBodyActive = true later. See the documentation for gotchas about changing physics body properties (i.e. you need to use small delays).
One last note about the use of the edge shape body. Even if the shape of the path did need to change in a controlled way, you might get better performance destroying the existing edge body and creating a new one along the new path rather than moving around a huge number of little circular bodies.
groupIndexparameter in the collision filter? - GoojajiGreg