Hey Pejman,
personally, I would stay away from messing around with the FEM file. Once you've read the file specs, you'll pbly understand why.
The "wise way" that I'd rather suggest is using the InferFace Manager (IFM) to create your own data importers (and exporters, if needed). This can be done, so that these importers are called automatically before every flow simulation (PreSimulation) for example. All you need to do then, is manipulate the default input files for those importers externally. This, however, can be done in a much safer way, since you define the format of these input (ASCII) files yourself, and hence you know exactly how to modify the data.
We've used this approach with SensAn, a Sensitivity Analysis tool, that's freely availbale as part of the PEST package. See attached flowchart for details.
Coming from MatLab, you pbly know enough C syntax already. That plus a C compiler is all you need really.
Chris