The title of your question is about using your own physics engine, but you also mention altering the behavior of simulation elements . To me this implies you'd like to use an existing physics engine but change its behavior. I'll try to answer both versions.
Use a new physics engine
Option 1 : Implement the physics API
If you have an existing physics engine, you can implement Gazebo's physics interface just as ODE, Bullet, Simbody, and DART have done. This is a non-trivial amount of work. Take a look at the PhysicsFactory, and at the ODE implementation for reference.
Option 2: Use gazebo as a library
You can use gazebo as a library, which would allow your physics engine to control simulation. Take a look here for a simple example of using gazebo in a custom main loop.
Option 3: Write a plugin
You could write a world or system plugin that loads your physics engine, and also control gazebo. Here are a few tutorials.
Alter simulation elements
Option 1: Write a plugin
You could write a plugin to move, spawn, delete and adjust the properties of models. Tutorials.
Option 2: Fork gazebo and make changes in the code
You can always fork gazebo, and directly modify the code to do anything you want. This approach could produce fast results, but would be difficult to maintain.
There are probably other methods, but these are good starting points.