1. Download JKSM (JK's Save Manager) and Install it (if you have FBI 2.4.1, select the 'TitleDB' section of FBI's main menu then find it in the list, press A and install it) and Exit FBI.
2. Unwrap JKSM and start it, wait while it loads, select 'SD/CIA' from the main menu
3. Find your game in the list, choose 'Export Save', Select 'New', type in a name for the backup and press A, then press A again when its finished.
4. Your save is now exported, press B a few times to go back to the 3DS Home Menu.
You can find your save at SD:\JKSV\Saves\<Game Name Here>\<Your Backup Name>
Inside that folder should be a file called 'main', this is your Pokemon Save Game.
Copy the folder that contains the save to your computer (via SD card reader or Wifi)
Open the 'main' file in PKHex, edit what you like, once done 'EXPORT' the save using the menu.
Next, transfer the edited save back onto your SD card (where the original save 'folder' was).
Put the main file in a new folder (call it 'editedsave' or something like that) so you know which is your edited save.
(edit: so you should have a folder like: "SD:\JKSV\Saves\Pokemon X\editedsave\" which contains a file called 'main')
(Don't overwrite your original 'main' save, keep a copy just in case your save game get corruption etc you can restore the original)
Turn on your 3DS, start JKSM again, select SD/CIA, select your game, but this time choose import save,
select your edited save from the list (if it doesn't show, you probably forgot to put it in a folder) and import it...
Next, start your Pokemon Game and you should be using your edited save.