DS roms (and every other rom that comes on a cartridge) uses chips to store data, while you could get a chip to store 437 Mbytes of data it would be pointless and expensive so they come as powers of two e.g. 2,4,8,16,32,64,128.....). Naturally your game code may not take up the entire space available so any remaining space is filled with 00's or FF's (hexadecimal ), on rare occasions they are 00FF00FF.....
You can trim these quite easily and usually nothing happens, if something does (possibly 1 in 100 will be affected) the chances are you accidently dropped a file/section end byte or two. Should you give a few back with a hex editor (8 will be fine) you will be on your way again.
How much you can remove varies wildly: something like snowboard kids (US) is almost halved and the new pokemon games are more than halved, in contrast Starfox uses extensive compression to get the rom down in size and you will only be able to trim a few KB as a consequence.
GBA section:
What I said above applies but there are some issues here:
Overdumped games: Unlike the DS the GBA roms do not have chip size indicated in the header so it is pretty much guesswork when dumping them, this can lead to under and overdumped roms. Overdumped roms will usually not be able to be trimmed at all (most dumpers add 0C's or 01's in which trimmers do not delete).
If your GBA game does not trim at all then it would be a wise idea to have a look and see if it is overdumped (a recent overdump would be that of FF5 Japanese version which is actually 64Mbit as opposed to 128).
GBATA has nice overdump fixing features:
http://www.gbadat.altervista.org/tools.htm
256Mbit roms:
A few of these have junk bytes added to the end of the rom (Riviera (US), Mother3 and Bleach being good examples). You can drop these with a hex editor and then trim as usual (these are some of the cases where adding a few bytes back is a good idea, my advice is to delete the junk bytes and go to the start of the 00/FF section and replace one of the 00/FF bytes with something else).
Intro bearing roms: early intro's were added at the end of the rom which messed up trimmers.
Patched/hacked roms: same theory as above for some hacks and patches.
Somewhere between the two examples above is Silent Hill for the GBA which seems to have a date in ASCII at the end of the rom, consequently you can not trim it.
DS section:
The DS uses a file system method of storing roms, this can be utilised for hacking purposes and for trimming purposes:
http://www.sosuke.com/ezflash/viewtopic.php?t=457
The link above details what you have to do extensively but simply put you can replace soundfiles, remove levels and cutscenes ultimately saving space (Castlevania for example can be more than halved by conventional trimming and removing the intro, replacing the sound with an ultra small file makes it a quarter of the original size)
Also it would seem that official builders of DS roms like to add space so a quick deconstriction and rebuild of the file system can save some space too (Tetris DS Japan and US version have over 2 megabytes of 00's added at the end of the soundfile.