What does the command `adb sideload FILE` do? I am reading a tutorial on the sideload command at link.

It contains the steps of rebooting into recovery mode and using adb sideload [file].zip.

My question is that what does sideload actually do with that zip file ? In the past I have compiled AOSP and flashed a device using


adb reboot-bootloader
adb fastboot flashall -w


Is sideload trying to achieve something similar to the above ?

Edit:

I think my confusion relating to sideload stems from my lack of understanding of how Android's memory is structured. I found two links.

First is a link that explains Android partitions : partitions

Second is a SO answer, that explains Android's memory: memory

Now my understanding so far is this :

Android has RAM and ROM. ROM is divided into several partitions, namely, /system, /data, /boot, /recovery, /cache, /misc and /sdcard.

Now the link relating to sideload states that this command installs a zip file.

What I don't understand still is that, is this zip file, going to replace the entire ROM in Android ? Namely, will it have to have the right partitions as in the list above ?

This also makes me confused about a similar command 'fastboot flashall'. I know when I run it, the terminal goes by saying its writing to several of the partitions. So my questions boil down to these :

1) Is sideload replacing entire ROM ?

2) Is the related command 'fastboot flashall' also replacing entire ROM ?

3) Are there ways to replace select partitions ?

Thanks.
Adb sideload command just loads a zip file from the computer to the phone. The creator of the zip controls what it does (the recovery just uploads it from the computer and looks at a specific file).

You can do a lot with it, but it's not a full rom, it's cannot replace a rom. 
Here is an example of an update.zip I once wrote and sideloaded it to a phone:

mount("yaffs2", "MTD", "userdata", "/data");
delete("/data/system/gesture.key");
delete("/data/system/password.key");
ui_print("Done!");


It deletes a couple of files, and prints a successful result. 

2.The command fastboot flash all can replace an entire rom, because it does a bunch of operations like format a partition and install a new rom. But you can flash other files that don't do those things (but often this command do exactly that.) 

3.You can do a lot of things in the adb command line, like delete a partition a flash or just copy something else to it. What exactly do you want to do? On which partition? 

Hope this is helpful, and check out the android developers page on adb ( http://developer.android.com/tools/help/adb.html ).